import request from '@/utils/request'

// 获取员工列表
export function getEmployeeList(params) {
  return request({
    url: '/api/employees',
    method: 'get',
    params
  })
}

// 根据ID获取员工详情
export function getEmployeeById(id) {
  return request({
    url: `/api/employees/${id}`,
    method: 'get'
  })
}

// 新增员工
export function createEmployee(data) {
  return request({
    url: '/api/employees',
    method: 'post',
    data
  })
}

// 更新员工信息
export function updateEmployee(id, data) {
  return request({
    url: `/api/employees/${id}`,
    method: 'put',
    data
  })
}

// 删除员工
export function deleteEmployee(id) {
  return request({
    url: `/api/employees/${id}`,
    method: 'delete'
  })
}

// 批量删除员工
export function batchDeleteEmployees(ids) {
  return request({
    url: '/api/employees/batch',
    method: 'delete',
    data: { ids }
  })
}

// 导出员工Excel
export function exportEmployees(params) {
  return request({
    url: '/api/employees/export',
    method: 'get',
    params,
    responseType: 'blob'
  })
}

// 获取员工角色选项
export function getEmployeeRoles() {
  return request({
    url: '/api/employees/roles',
    method: 'get'
  })
}

// 获取业务经理选项（用于客户管理）
export function getManagerOptions() {
  return request({
    url: '/api/employees/managers',
    method: 'get'
  })
} 